import request from '@/util/request'
import store from '@/vuex/store'
import config from "@/config/config";

// 查询初审列表
export function getBnBasicInfoListApi(list) {
    const value = {
        pageSize: list.pageSize,
        currentPage: list.currentPage,
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'init/getInitList.do',
        method: 'post',
        data: value
    })
}

//暂存业务
export function saveProApi(pro, fileList) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(pro),
        file: fileList
    }
    return request({
        url: 'bnBasicInfo/saveBnBasicInfo.do',
        method: 'post',
        data: value
    })
}

//业务列表(类型)
export function getBussiListApi(list) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'bnBasicInfo/getBussiList.do',
        method: 'post',
        data: value
    })
}

//删除
export function deleteApplyApi(idCard) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(idCard)
    }
    return request({
        url: 'bnBasicInfo/deleteApply.do',
        method: 'post',
        data: value
    })
}
//提交 state +1
export function commitProApi(pro) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(pro)
    }
    return request({
        url: 'bnBasicInfo/conmitPro.do',
        method: 'post',
        data: value
    })
}
//退件
export function returnProApi(pro) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(pro)
    }
    return request({
        url: 'bnBasicInfo/returnPro.do',
        method: 'post',
        data: value
    })
}
//onceAgainApi重做
export function onceAgainApi(pro) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(pro)
    }
    return request({
        url: 'bnBasicInfo/onceAgain.do',
        method: 'post',
        data: value
    })
}

//查身份证是否可用
export function queryIdCordApi(idCard) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: idCard
    }
    return request({
        url: 'bnBasicInfo/queryIdCord.do',
        method: 'post',
        data: value
    })
}

//条件搜索查询 
// export function getBnBasicInfoByVoApi(list) {
//     const params = {
//         pageSize: list.pageSize,
//         currentPage: list.currentPage,
//         id: list.id,
//         name: list.name,
//         idCard: list.idCard,
//         //param: JSON.stringify(list)
//     }
//     const value = {
//         appKey: '',
//         appFlag: 2,
//         token: store.getters.token,
//         versionCode: 0,
//         param: JSON.stringify(params)
//     }
//     return request({
//         url: 'bnBasicInfo/getBnBasicInfoByVo.do',
//         method: 'post',
//         data: value
//     })
// }

//根据applyCode查询基本信息
export function getBnBasicInfoApi(applyCode) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: applyCode
    }
    return request({
        url: 'bnBasicInfo/getBnBasicInfo.do',
        method: 'post',
        data: value
    })
}
export function getMapInfoApi(applyCode) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: applyCode
    }
    return request({
        url: 'bnBasicInfo/getMapInfoApi.do',
        method: 'post',
        data: value
    })
}
export function editProApi(pro, fileList) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(pro),
        file: fileList
    }
    return request({
        url: 'bnBasicInfo/editBnBasicInfo.do',
        method: 'post',
        data: value
    })
}
//地图表查询
export function getFourPoint() {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0
    }
    return request({
        url: 'location/queryAllLocation.do',
        method: 'post',
        data: value
    })
}
//条件搜索图形
export function searchByApi(list) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: list
    }
    return request({
        url: 'bnBasicInfo/searchBy.do',
        method: 'post',
        data: value
    })
}


export function getInconformityTempApi() {
    var params = new URLSearchParams();
    params.append('appKey', '');
    params.append('appFlag', 1);
    params.append('versionCode', 1);
    params.append("token", store.getters.token);

    window.location.href = (config.baseUrl + "/document/downloadInconformityTemp?params=" + params);
}
//更新移动后的坐标
export function updatePointApi(foursite) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(foursite)
    }
    return request({
        url: 'bnBasicInfo/updatePoint.do',
        method: 'post',
        data: value
    })
}


